import type { RouteRecordRaw } from 'vue-router'
import { createRouter } from 'vue-router'
import Layout from '@/layout/Layout.vue'

export let constantRouterMap: AppRouteRecordRaw[] = [
  {
    name: 'home',
    path: '/',
    redirect: '/home/index',
    component: Layout,
    meta: {
      title: '主页',
      isNav: true
    },
    children: [
      {
        name: 'home/index',
        path: '/home/index',
        component: () => import('@/views/homeView.vue'),
        meta: {
          title: '首页',
          breadcrumb: false,
          hasNav: false,
          isNav: true
        }
      },
      {
        name: 'centerIntroductory',
        path: '/centerIntroductory',
        component: () => import('@/views/centerIntroductory/index.vue'),
        meta: {
          title: '中心简介',
          isNav: true
        }
      },
      {
        path: '/centerIntroductoryDetails',
        name: 'centerIntroductoryDetails',
        component: () => import('@/views/centerIntroductoryDetails/index.vue'),
        meta: {
          hidden: true,
          title: '中心简介详情',
          activeMenu: '/centerIntroductory',
          parentName: 'centerIntroductory',
          canTo: true
        }
      },
      {
        path: '/capacityDetails',
        name: 'capacityDetails',
        component: () => import('@/views/capacityDetails/index.vue'),
        meta: {
          hidden: true,
          title: '能力展示详情',
          activeMenu: '/centerIntroductory',
          parentName: 'centerIntroductory',
          canTo: true
        }
      },
      {
        path: '/serviceDetails',
        name: 'serviceDetails',
        component: () => import('@/views/serviceDetails/index.vue'),
        meta: {
          hidden: true,
          title: '服务详情'
        }
      },
      {
        path: '/requirementSolution',
        name: 'requirementSolution',
        component: () => import('@/views/requirementSolution/index.vue'),
        meta: {
          title: '供需对接',
          isNav: true
        }
      },
      {
        path: '/unitMap',
        name: 'unitMap',
        component: () => import('@/views/unitMap/index.vue'),
        meta: {
          title: '联盟链网',
          isNav: true
        }
      },
      {
        path: '/technologyAssociation',
        name: 'technologyAssociation',
        component: () => import('@/views/technologyAssociation/index.vue'),
        meta: {
          title: '科技社群',
          isNav: true
        }
      },
      {
        path: '/technologyAssociationDetails',
        name: 'technologyAssociationDetails',
        component: () => import('@/views/technologyAssociationDetails/index.vue'),
        meta: {
          hidden: true,
          title: '科技社群详情',
          activeMenu: '/technologyAssociation',
          parentName: 'technologyAssociation',
          canTo: true
        }
      },
      {
        path: '/technologyAssociationDetails2',
        name: 'technologyAssociationDetails2',
        component: () => import('@/views/technologyAssociationDetails2/index.vue'),
        meta: {
          hidden: true,
          title: '知识科普详情',
          activeMenu: '/technologyAssociation',
          parentName: 'technologyAssociation',
          canTo: true
        }
      },
      {
        path: '/conferenceTraining',
        name: 'conferenceTraining',
        component: () => import('@/views/conferenceTraining/index.vue'),
        meta: {
          title: '会议培训',
          isNav: true
        }
      },
      {
        path: '/conferenceTrainingDetails',
        name: 'conferenceTrainingDetails',
        component: () => import('@/views/conferenceTrainingDetails/index.vue'),
        meta: {
          hidden: true,
          title: '会议培训详情',
          activeMenu: '/conferenceTraining',
          parentName: 'conferenceTraining',
          canTo: true
        }
      },
      {
        path: '/typicalCase',
        name: 'typicalCase',
        component: () => import('@/views/typicalCase/index.vue'),
        meta: {
          title: '典型案例',
          isNav: true
        }
      },
      {
        path: '/typicalCaseDetails',
        name: 'typicalCaseDetails',
        component: () => import('@/views/typicalCaseDetails/index.vue'),
        meta: {
          hidden: true,
          title: '典型案例详情',
          activeMenu: '/typicalCase',
          parentName: 'typicalCase',
          canTo: true
        }
      },
      {
        path: '/news',
        name: 'news',
        component: () => import('@/views/news/index.vue'),
        meta: {
          title: '新闻资讯',
          isNav: true
        }
      },
      {
        path: '/newsDetails',
        name: 'newsDetails',
        component: () => import('@/views/newsDetails/index.vue'),
        meta: {
          hidden: true,
          title: '新闻资讯详情',
          activeMenu: '/news',
          parentName: 'news',
          canTo: true
        }
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login/index.vue'),
    name: 'Login',
    meta: {
      hidden: true,
      title: '登录',
      noTagsView: true
    }
  },
  {
    path: '/redirect/:path(.*)',
    name: 'Redirect',
    component: () => import('@/views/Redirect/Redirect.vue'),
    meta: {
      hidden: true,
      noTagsView: true
    }
  },
  {
    path: '/personalCenter',
    name: 'personalCenter',
    redirect: '/requirementsApproval',
    component: () => import('@/views/personalCenter/index.vue'),
    meta: {
      hidden: true,
      title: '个人中心 ',
      noTagsView: true
    },
    children: [
      {
        path: '/requirementsApproval',
        name: 'requirementsApproval',
        component: () => import('@/views/requirementsApproval/index.vue'),
        meta: {
          title: '需求审批'
        }
      },
      {
        path: '/theDemandIsOver',
        name: 'theDemandIsOver',
        component: () => import('@/views/theDemandIsOver/index.vue'),
        meta: {
          title: '需求完结'
        }
      },
      {
        path: '/myNeeds',
        name: 'myNeeds',
        component: () => import('@/views/myNeeds/index.vue'),
        meta: {
          title: '我的需求'
        }
      },
      {
        path: '/myPlan',
        name: 'myPlan',
        component: () => import('@/views/myPlan/index.vue'),
        meta: {
          title: '我的方案'
        }
      }
    ]
  }
]

export let asyncRouterMap: AppRouteRecordRaw[] = [
  {
    name: 'cases',
    path: '/cases',
    component: () => import('../views/cases/index.vue'),
    meta: {
      title: '案例'
    }
  },
  {
    name: 'cases/detail',
    path: '/cases/detail',
    component: () => import('../views/cases/detail.vue'),
    meta: {
      title: '案例详情'
    }
  },
  {
    name: 'faqs',
    path: '/faqs',
    component: () => import('../views/faqs.vue'),
    meta: {
      title: '常见问题'
    }
  },
  {
    name: 'faqs/detail',
    path: '/faqs/detail',
    component: () => import('../views/faqs/detail.vue'),
    meta: {
      title: '常见问题详情'
    }
  }
]
const router = createRouter({
  history: createWebHashHistory(),
  routes: constantRouterMap as RouteRecordRaw[]
})

export default router
